<meta charset="utf-8">
<script>
    var rightpwd = "qwer";
    var inputpwd = prompt("请您输入密码：");
    var pwdcount = 1;
    while(inputpwd!=rightpwd){
        alert("您输入的密码错误！");
        pwdcount++;
        inputpwd = prompt("请您输入密码：");   
        if(pwdcount==3){
            break;
        }
    }
    if(inputpwd==rightpwd){
        alert("登录成功");
    }else{
        alert("输入密码次数太多！");
    }
</script>